package NGUYENVANDOAN.OOP.EXCERCISES.LEVEL02.EX01_OPTIONAL;

public class TriangleEntity {
    // 1. Datafield
    private double side01;
    private double side02;
    private double side03;

    // 2. Constructors
    public TriangleEntity() {
        //
        side01 = 1.0;
        side02 = 1.0;
        side03 = 1.0;
    }

    // 2. Constructors
    TriangleEntity(double side01, double side02, double side03) {
        this.side01 = side01;
        this.side02 = side02;
        this.side03 = side03;
    }

    public double getSide01() {
        return side01;
    }

    public void setSide01(double side01) {
        this.side01 = side01;
    }

    public double getSide02() {
        return side02;
    }

    public void setSide02(double side02) {
        this.side02 = side02;
    }

    public double getSide03() {
        return side03;
    }

    public void setSide03(double side03) {
        this.side03 = side03;
    }

    public double Area(TriangleEntity objEntity) {
        double p = (objEntity.getSide01() + 
                                objEntity.getSide02() + 
                                objEntity.getSide03()) / 2;

        return Math.sqrt(p * 
                                (p - objEntity.getSide01()) * 
                                (p - objEntity.getSide02()) * 
                                (p - objEntity.getSide03()));
    }
    
    public double Perrimeter(TriangleEntity objEnnity){
    	return     objEnnity.getSide01()+
    	                    objEnnity.getSide02()+
    	                    objEnnity.getSide03();
    }
}
